package com.chenglu.android.payment.adapter;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.payment.bean.CouponListBean;
import com.chenglu.android.payment.bean.PostTimeListBean;

import java.util.List;

/**
 * @author: lyj
 * @Created: by Copyright 2023 6 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：
 */
public class DayTimeListAdapter extends BaseQuickAdapter<PostTimeListBean.Data, BaseViewHolder> {

     Context mContext;
    public DayTimeListAdapter(Context context, @Nullable List<PostTimeListBean.Data> data) {
        super(R.layout.item_day_timelist, data);
        this.mContext = context;
    }
      boolean isShow = true;
    @Override
    protected void convert(@NonNull BaseViewHolder helper,PostTimeListBean.Data item) {

        if(item==null){
            return;
        }
        if(helper.getAdapterPosition() == getthisPosition()){
            helper.setText(R.id.tv_day_time,item.getTimeHouseAndMinute())
            .setTextColor(R.id.tv_day_time,mContext.getResources().getColor(R.color.color_time_choose));
        }else {
            helper.setText(R.id.tv_day_time,item.getTimeHouseAndMinute())
                    .setTextColor(R.id.tv_day_time,mContext.getResources().getColor(R.color.all_black_text));
        }



    }


    //先声明一个int成员变量,若为0默认显示第一个
    private int thisPosition = 1001;


    //再定义一个int类型的返回值方法
    public int getthisPosition() {
        return thisPosition;
    }

    //   传入点击的位置
    public void setThisPosition(int thisPosition) {
        this.thisPosition = thisPosition;
        notifyDataSetChanged();
    }
}
